home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9108 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: argc/argv & switches
  5. Date: 7 Mar 1996 20:34:06 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hodbuINNlvv@keats.ugrad.cs.ubc.ca>
  8. References: <4h2j8j$9gn@milo.freenet.vancouver.bc.ca> <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca> <danpop.826238070@rscernix> <4ho9dv$bcb@castle.nando.net>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4ho9dv$bcb@castle.nando.net>,
  12. Bill McCarthy <actuary@nando.net> wrote:
  13.  >In <danpop.826238070@rscernix>,
  14.  >danpop@mail.cern.ch (Dan Pop) writes:
  15.  >
  16.  >>In <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
  17.  >>c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  18.  >>
  19.  >>>However, if it were the case that these pointers are not modifiable, 
  20.  >>
  21.  >>It _is_ the case.  An attempt to modify a pointer from the argv "array" 
  22.  >>results in undefined behaviour.
  23.  >
  24.  >According to Herbert Schildt, 5.1.2.2.1 states "The parameters argc and
  25.  >argv and the strings pointed to by the argv array shall be modifiable
  26.  >by the program, and retain their last-stored values between program
  27.  >startup and program termination."
  28.  >
  29.  >I'm just reading the standard for the first time, and am only up to page
  30.  
  31. Good for you!
  32.  
  33.  >26 :-( so be kind - what am I missing?
  34.  
  35. You are missing the observation that argv is a pointer to an array of objects.
  36. These objects are pointers to char. Although argv is modifiable, these char
  37. pointers are not. The funny thing is that the data they point to _is_
  38. modifiable.
  39.  
  40. Hope this muddies the waters for you.
  41.  
  42. -- 
  43.  
  44.